home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / iso-wide.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-21  |  1.7 KB  |  49 lines

  1. /* This file is part of XEmacs.
  2.  
  3. XEmacs is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the
  5. Free Software Foundation; either version 2, or (at your option) any
  6. later version.
  7.  
  8. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11. for more details.
  12.  
  13. You should have received a copy of the GNU General Public License
  14. along with XEmacs; see the file COPYING.  If not, write to the Free
  15. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  16.  
  17. /* Synched up with: Not in FSF. */
  18.  
  19. #ifndef _XEMACS_ISO_WIDE_H
  20. #define _XEMACS_ISO_WIDE_H
  21.  
  22. /* The following macros are designed for SunOS 5.0 wide characters,
  23.    in which the single byte ISO Latin-1 character 1xxxxxxx are represented
  24.  
  25.         00110000 00000000 00000000 0xxxxxxx
  26.  
  27.    For wide character systems which maintain the numeric value of all
  28.    single-byte characters, IN_TABLE_DOMAIN can simply be defined
  29.  
  30.         (0 <= (c) && (c) <= 0xff)
  31.  
  32.    and no funky ISO_WIDE_TO_BYTE conversions are needed. */
  33.  
  34. /* Can't use isascii() because we want wide char argument */
  35. #define IS_ASCII(c)     (0 <= (c) && (c) <= 0x7f)
  36.  
  37. #define IS_ISO_WIDE(c)  (0x30000000 <= (c) && (c) <= 0x3000007f)
  38. #define IS_ISO_BYTE(c)  (0x80 <= (c) && (c) <= 0xff)
  39.  
  40. #define IN_TABLE_DOMAIN(c)  (IS_ASCII (c) || IS_ISO_WIDE (c))
  41.  
  42. #define ISO_WIDE_TO_BYTE(c)  ((c) & 0x0000007f | 0x80)
  43. #define ISO_BYTE_TO_WIDE(c)  ((c) & 0x7f | 0x30000000)
  44.  
  45. #define WIDE_TO_BYTE(c)  (IS_ISO_WIDE (c) ? ISO_WIDE_TO_BYTE (c) : (c))
  46. #define BYTE_TO_WIDE(c)  (IS_ISO_BYTE (c) ? ISO_BYTE_TO_WIDE (c) : (c))
  47.  
  48. #endif /* _XEMACS_ISO_WIDE_H */
  49.